home *** CD-ROM | disk | FTP | other *** search
- /**********************************************************************\
-
- File: BoxIn fade.c
-
- Purpose: Graphic effect to fade main window to solid pattern.
- See comments below for more description.
-
- This program is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 2 of the License, or
- (at your option) any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program in a file named "GNU General Public License".
- If not, write to the Free Software Foundation, 675 Mass Ave,
- Cambridge, MA 02139, USA.
-
- \**********************************************************************/
-
- #include "timing.h"
-
- #define theWindowHeight (boundsRect.bottom-boundsRect.top)
- #define theWindowWidth (boundsRect.right-boundsRect.left)
- #define CorrectTime 3
-
- pascal short BoxInFade(Rect boundsRect, Pattern *thePattern);
-
- /* Basically, there are four bars -- one starts at the top and moves down;
- one starts at the bottom and moves up; one starts at the left and moves
- right; one starts at the right and moves left. There's a lot of overlap
- of bitcopying, but it's masked by the timing correction */
-
- pascal short BoxInFade(Rect boundsRect, Pattern *thePattern)
- {
- Rect vsource1,vsource2, hsource1, hsource2;
- int vbar,hbar;
- int HBarGap,VBarGap;
-
- VBarGap=theWindowWidth/50;
- HBarGap=theWindowHeight/50;
- vbar=boundsRect.left;
- hbar=boundsRect.top;
- vsource1.top=vsource2.top=boundsRect.top;
- vsource1.bottom=vsource2.bottom=boundsRect.bottom;
- hsource1.left=hsource2.left=boundsRect.left;
- hsource1.right=hsource2.right=boundsRect.right;
- while (vbar<boundsRect.left+theWindowWidth/2+VBarGap)
- {
- StartTiming();
- vsource1.left=vbar;
- vsource1.right=vsource1.left+VBarGap;
- vsource2.right=2*boundsRect.left+theWindowWidth-vbar;
- vsource2.left=vsource2.right-VBarGap;
- hsource1.top=hbar;
- hsource1.bottom=hsource1.top+HBarGap;
- hsource2.bottom=2*boundsRect.top+theWindowHeight-hbar;
- hsource2.top=hsource2.bottom-HBarGap;
- FillRect(&vsource1, *thePattern);
- FillRect(&hsource1, *thePattern);
- FillRect(&vsource2, *thePattern);
- FillRect(&hsource2, *thePattern);
- vbar+=VBarGap;
- hbar+=HBarGap;
- TimeCorrection(CorrectTime);
- }
-
- return 0;
- }
-